package com.ms.test10;

import java.util.Arrays;

/**
 * 数组比较的是内存地址；
 * 如果要比较内容，使用 Array.equals（）；选择适当的重载的方法；
 * @author carter
 * create time    2018-08-20
 */
public class TestArray {

    public static void main(String[] args) {
        char[] chars = new char[2];
        chars[0] = 'a';
        chars[1] = 'b';


        char[] chars1 = new char[2];
        chars1[0] = 'a';
        chars1[1] = 'b';

        System.out.println(chars.equals(chars1));//false

        System.out.println("==================");

        String s1 = new String(chars);
        String s2 = new String(chars1);

        System.out.println(s1.equals(s2));//true
        System.out.println("==================");
        System.out.println(Arrays.equals(chars,chars1));//true

    }

}
